package com.mapoffline.zbcx.mapoffline;

import android.graphics.drawable.Drawable;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;

import com.mapbox.mapboxsdk.overlay.UserLocationOverlay;
import com.mapbox.mapboxsdk.tileprovider.tilesource.ITileLayer;
import com.mapbox.mapboxsdk.tileprovider.tilesource.MBTilesLayer;
import com.mapbox.mapboxsdk.views.MapView;

public class MainActivity extends AppCompatActivity
{
    private MapView mv;
    private UserLocationOverlay myLocationOverlay;
    private String currentMap = null;
    private LocationManager locationManager;
    private Drawable drawable;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mv = (MapView) findViewById(R.id.mapview);
        final MBTilesLayer mbTileLayer = new MBTilesLayer(Environment.getExternalStorageDirectory()
                .getPath() + "/Tencent/QQfile_recv/test.mbtiles");
        mv.setTileSource(new ITileLayer[]{mbTileLayer});
        mv.setScrollableAreaLimit(mbTileLayer.getBoundingBox());
        mv.setMinZoomLevel(mv.getTileProvider().getMinimumZoomLevel());
        mv.setMaxZoomLevel(mv.getTileProvider().getMaximumZoomLevel());
        mv.setCenter(mv.getTileProvider().getCenterCoordinate());
        mv.setZoom(4);
        mv.setUserLocationEnabled(true);
    }
}
